home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / SCREEN.SWG / 0078_Hynopotic Screen Clear.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  4KB  |  138 lines

  1. { Here's a fancy little program! Give it a try and modify it if you like! }
  2.  
  3. program hypno; { very hypnotic! }
  4.  
  5. uses crt;
  6.  
  7. const
  8.   max_hypno=100;
  9.  
  10. type
  11.   string80=string[80];
  12.  
  13.   Procedure FastWrite(col,row,Attrib:Byte; Str:string80);
  14.   begin
  15.     inline
  16.       ($1E/$1E/$8A/$86/row/$B3/$50/$F6/$E3/$2B/$DB/$8A/$9E/col/
  17.       $03/$C3/$03/$C0/$8B/$F8/$be/$00/$00/$8A/$BE/attrib/
  18.       $8a/$8e/str/$22/$c9/$74/$3e/$2b/$c0/$8E/$D8/$A0/$49/$04/
  19.       $1F/$2C/$07/$74/$22/$BA/$00/$B8/$8E/$DA/$BA/$DA/$03/$46/
  20.       $8a/$9A/str/$EC/$A8/$01/$75/$FB/$FA/$EC/$A8/$01/$74/$FB/
  21.       $89/$1D/$47/$47/$E2/$Ea/$2A/$C0/$74/$10/$BA/$00/$B0/
  22.       $8E/$DA/$46/$8a/$9A/str/$89/$1D/$47/$47/$E2/$F5/$1F);
  23.   end;
  24.  
  25. var
  26.   x_speed,
  27.   x_speed_count,
  28.   x_xpos,
  29.   x_color,
  30.   x_alive,
  31.   x_dir,
  32.   x_ypos:array[1..max_hypno] of integer;
  33.   x_type:array[1..max_hypno] of string[1];
  34.   color1,color2,x,i,j,k,g:integer;
  35.  
  36. procedure setup;
  37. begin
  38.   for x:=1 to max_hypno do
  39.     begin
  40.       x_speed[x]:=1;
  41.       x_speed_count[x]:=0;
  42.       case random(3)+1 of
  43.         1:x_type[x]:='';
  44.         2:x_type[x]:='';
  45.         3:x_type[x]:='';
  46.       end;
  47.       x_xpos[x]:=random(80)+1;
  48.       x_dir[x]:=random(2)+1;
  49.       x_alive[x]:=0;
  50.       x_ypos[x]:=50;
  51.       x_color[x]:=random(15)+1;
  52.       color1:=random(255)+1;
  53.       color2:=random(255)+1;
  54.     end;
  55. end;
  56.  
  57. var
  58.   counter:integer;
  59.  
  60. procedure move_hypnos;
  61. var
  62.   oldx,oldy:integer;
  63.   moved:boolean;
  64. begin
  65.   if random(32767)=1 then
  66.     begin
  67.       color1:=random(255)+1;
  68.       color2:=random(255)+1;
  69.     end;
  70.   counter:=counter+1;
  71.   if counter>max_hypno then counter:=1;
  72.   oldx:=x_xpos[counter];
  73.   oldy:=x_ypos[counter];
  74.   moved:=false;
  75.   if x_alive[counter]=0 then if random(1100)=500 then
  76.     x_alive[counter]:=1;
  77.   if x_alive[counter]=1 then
  78.     begin
  79.       x_speed_count[counter]:=x_speed_count[counter]+1;
  80.       if x_speed_count[counter]>=x_speed[counter] then
  81.         begin
  82.  
  83.           case random(5)+1 of
  84.             1:begin
  85.                 x_ypos[counter]:=x_ypos[counter]+1;
  86.                 if x_ypos[counter]>50 then x_ypos[counter]:=1;
  87.               end;
  88.             2:begin
  89.                 x_ypos[counter]:=x_ypos[counter]-1;
  90.                 if x_ypos[counter]<0 then x_ypos[counter]:=50;
  91.               end;
  92.           end;
  93.           x_speed_count[counter]:=0;
  94.           case x_dir[counter] of
  95.             1:begin
  96.                 x_xpos[counter]:=x_xpos[counter]-1;
  97.                 if x_xpos[counter]<0 then
  98.                   begin
  99.                     x_speed[counter]:=random(5)+1;
  100.                     x_speed_count[counter]:=0;
  101.                     x_xpos[counter]:=80;
  102.                     x_ypos[counter]:=random(50)+1;
  103.                     x_dir[counter]:=random(2)+1;
  104.                   end;
  105.               end;
  106.             2:begin
  107.                 x_xpos[counter]:=x_xpos[counter]+1;
  108.                 if x_xpos[counter]>80 then
  109.                   begin
  110.                     x_speed[counter]:=random(5)+1;
  111.                     x_speed_count[counter]:=0;
  112.                     x_xpos[counter]:=0;
  113.                     x_ypos[counter]:=random(50)+1;
  114.                     x_dir[counter]:=random(2)+1;
  115.                   end;
  116.               end;
  117.           end;
  118.         end;
  119.     end;
  120.   moved:=false;
  121.   if x_xpos[counter]<>oldx then moved:=true;
  122.   if x_ypos[counter]<>oldy then moved:=true;
  123.   if moved=true then
  124.     begin
  125.       if x_dir[counter]=1 then fastwrite(oldx,oldy,color2,' ')
  126.         else fastwrite(oldx,oldy,color1,' ');
  127.       fastwrite(x_xpos[counter],x_ypos[counter],
  128.         x_color[counter],x_type[counter]);
  129.     end;
  130. end;
  131.  
  132. begin
  133.   randomize;
  134.   setup;
  135.   counter:=0;
  136.   while not keypressed do move_hypnos;
  137. end.
  138.